package com.ajnp.springcloud.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController
@RequestMapping("/consumer")
public class ConsulController {

    public static final String Consul_INTO = "http://cloud-provider-payment";

    @Resource
    private RestTemplate restTemplate;

    @RequestMapping("/payment/consul")
    public String getConsul() {
        return restTemplate.getForObject(Consul_INTO + "/payment/consul", String.class);
    }

    //CAP 表示 Consistency、Availability、Partition tolerance，即强一致性、可用性以及分区容错性。

}
